﻿using System.Security.Cryptography;
using System.Text;

namespace Micro.Extensions.Utilities
{
    public static class Md5Util
    {
        ///<summary>
        /// md5加密
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public static string Md5(string input)
        {
            using var md5 = MD5.Create();
            var data = md5.ComputeHash(Encoding.UTF8.GetBytes(input));
            var builder = new StringBuilder();
            foreach (var t in data)
            {
                builder.Append(t.ToString("X2"));
            }
            return builder.ToString();
        }
    }
}
